package com.changgou.service.impl;

import com.changgou.dao.ItemInfoMapper;
import com.changgou.service.ItemInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author: hushengjin
 */
@Service
public class ItemInfoServiceImpl implements ItemInfoService {

    @Autowired
    private ItemInfoMapper itemInfoMapper;

    /**
     * 商品库存递减
     *
     * @param id
     * @param count
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean decrCount(int id, int count) {
        int i = itemInfoMapper.decrCount(id, count);
        return i > 0;
    }
}
